package config

import "strconv"

type Mysql struct {
	Path     string `json:"path" yaml:"path"`
	Port     int16  `json:"port" yaml:"port"`
	Dbname   string `json:"dbname" yaml:"dbname"`
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
}

func (m Mysql) Dsn() string {
	return m.Username + ":" + m.Password + "@(" + m.Path + ":" + strconv.Itoa(int(m.Port)) + ")/" + m.Dbname + "?charset=utf8mb4&parseTime=True&loc=Local"
}
